{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell1\n",
    "[\"x\" : 1, \"y\" : 2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell1 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell1_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell2\n",
    "List list = new ArrayList();\n",
    "list.add([\"x\" : 1, \"y\" : 2]);\n",
    "list.add([\"x\" : 3, \"y\" : 4]);\n",
    "list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell2 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell2_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell3\n",
    "Map[] map = new Map[2];\n",
    "map[0] = [\"x\" : 1, \"y\" : 2]\n",
    "map[1] = [\"x\" : 3, \"y\" : 4]\n",
    "map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell3 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell3_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell4\n",
    "def listOfMap = []\n",
    "1.upto(3){\n",
    "    listOfMap += [\"test\": it, \"test2\": 2 * it]\n",
    "}\n",
    "listOfMap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell4 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell4_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell5\n",
    "def myMap = [:]\n",
    "def myList = []\n",
    "myList << [1, 2, 3]\n",
    "myList << [2, 3, 4]\n",
    "myMap.put(1, myList)\n",
    "myMap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell5 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell5_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell6\n",
    "def myMap = [:]\n",
    "def myList = [num1:1, num2:2]\n",
    "myMap.put(1, myList)\n",
    "myMap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell6 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell6_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell7\n",
    "new TableDisplay([[col1: \"This & that\", col2: \"This / that\", col3: \"This > that\"]]);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell7 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell7_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell8\n",
    "class MyClass {\n",
    "    def value;\n",
    "    public MyClass(String value) {\n",
    "        this.value = value\n",
    "    }\n",
    "    \n",
    "    public String toString() {\n",
    "        return this.value;\n",
    "    }\n",
    "}\n",
    "\n",
    "def clz = new MyClass(\"print this\")\n",
    "def tableData = [\n",
    "   [myclass:  clz]\n",
    "]\n",
    "displayObject = new TableDisplay(tableData);\n",
    "displayObject"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell8 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell8_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "//cell19\n",
    "tbl = new TableDisplay([x: '<em style=\"color:red\">italic red</em>',\n",
    "                      y: '<b style=\"color:blue\">bold blue</b>',\n",
    "                      z: 'multiline strings<br/>work fine too']);\n",
    "tbl.setStringFormatForColumn(\"Value\", TableDisplayStringFormat.getHTMLFormat())\n",
    "tbl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell9 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell9_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell10\n",
    "new TableDisplay(['Two Sigma': 'http://twosigma.com', 'BeakerX': 'surrounding text http://BeakerX.com works fine'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// cell10 expected result\n",
    "Image(\"../../resources/img/groovy/mapLikeTable/cell10_case1.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Groovy",
   "language": "groovy",
   "name": "groovy"
  },
  "language_info": {
   "codemirror_mode": "groovy",
   "file_extension": ".groovy",
   "mimetype": "",
   "name": "Groovy",
   "nbconverter_exporter": "",
   "version": "2.4.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": false,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": false,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
